package com.nti56.springboot.service;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.nti56.springboot.mapper.tmsmapper.DictItemMapper;
import com.nti56.springboot.model.Dict;
import com.nti56.springboot.model.DictItem;

@Service
public class DictItemService {
	
	private static final Logger logger = LoggerFactory.getLogger(DictItemService.class);
	
	@Autowired
    private DictItemMapper dictItemMapper;
	
	public DictItem getById(String id) {
		return dictItemMapper.getById(id);
	}
	
	public List<DictItem> findAll(Map params){
		return dictItemMapper.findAll(params);
	}
	
	@Transactional(rollbackFor = Exception.class, transactionManager = "tmsTransactionManager")
	public void insert(DictItem dictItem) {
		dictItemMapper.insert(dictItem);
	}
	
	@Transactional(rollbackFor = Exception.class, transactionManager = "tmsTransactionManager")
	public void update(DictItem dictItem) {
		dictItemMapper.update(dictItem);
	}
	
	@Transactional(rollbackFor = Exception.class, transactionManager = "tmsTransactionManager")
	public void deleteByDictId(String dictId) {
		dictItemMapper.deleteByDictId(dictId);
	}
	
	
	@Transactional(rollbackFor = Exception.class, transactionManager = "tmsTransactionManager")
	public void deleteBatch(List<String> list) {
		dictItemMapper.deleteBatch(list);
	}
}
